package com.example.demo.serviceimpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.entity.BookAssist;
import com.example.demo.mapper.BookAssistMapper;
import com.example.demo.service.BookAssistService;

/**
 * 点赞的实现类
 * 
 * @author wang
 *
 */
@Service
public class BookAssistServiceImpl implements BookAssistService {

	@Autowired
	private BookAssistMapper bookAssistMapper;

	/**
	 * 查询评论回复Id或者点赞id
	 */
	@Override
	public BookAssist selectComent(Integer id) {
		return bookAssistMapper.selectComent(id);
	}

	/**
	 * 查询点赞人数
	 */
	@Override
	public int selectComentId(Integer id) {
		return bookAssistMapper.selectComentId(id);
	}

	/**
	 * 添加点赞人的记录
	 */
	@Override
	public int insertComent(BookAssist bookAssist) {
		return bookAssistMapper.insertComent(bookAssist);
	}

	/**
	 * 删除点赞人的记录
	 */
	@Override
	public int deleteComent(Integer comentId, Integer userId) {
		return bookAssistMapper.deleteComent(comentId, userId);
	}

	/**
	 * 查询相同的人点赞时间一天内的数据
	 */
	@Override
	public Integer selectComentIdByTime(Integer comentId, Integer userId) {
		return bookAssistMapper.selectComentIdByTime(comentId, userId);
	}

	/**
	 * 查找用户id
	 */
	@Override
	public List<BookAssist> findUserId(Integer userId) {
		return bookAssistMapper.findUserId(userId);
	}

	/**
	 * 查询点赞表中的评论id，用户id
	 */
	@Override
	public BookAssist findCommentIdAndUserId(Integer id, Integer userId) {
		return bookAssistMapper.findCommentIdAndUserId(id, userId);
	}

}
